package com.example.gslih.myapplication.file;

import android.app.Activity;
import android.content.Context;
import android.os.Environment;

import com.example.gslih.myapplication.log.TtLogUtil;

import java.security.PublicKey;
import java.sql.Struct;

import static android.os.Environment.MEDIA_MOUNTED;

public class TtFilePathUtil {
    //当前包名  com.example.gslih.myapplication
    public static String getPackageName(Context context) {
        return context.getPackageName();
    }

    //当前类名  a.FilePathActivity
    public static String getLocalClassName(Activity activity) {
        return activity.getLocalClassName();
    }

    //内部File路径  /data/user/0/com.example.gslih.myapplication/files
    public static String getFilesDir(Context context) {
        return context.getFilesDir().toString();
    }

    //内部Cache路径  /data/user/0/com.example.gslih.myapplication/cache
    public static String getCacheDir(Context context) {
        return context.getCacheDir().toString();
    }

    //外部Cache路径  /storage/emulated/0/Android/data/com.example.gslih.myapplication/cache
    public static String getExternalCacheDir(Context context) {
        return context.getExternalCacheDir().toString();
    }

    //外部File路径  /storage/emulated/0/Android/data/com.example.gslih.myapplication/files
    public static String getExternalFilesDir(Context context) {
        return context.getExternalFilesDir("").toString();
    }

    //判断外部存储是否可用
    public static boolean ifExternalMounted() {
        return MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
    }

    //内部存储根目录  /data
    public static String getDataDirectory() {
        return Environment.getDataDirectory().toString();
    }

    //外部存储根目录  /storage/emulated/0
    public static String getExternalStorageDirectory() {
        return Environment.getExternalStorageDirectory().toString();
    }

    //公路径  /storage/emulated/0
    public static String getExternalStoragePublicDirectory() {
        return Environment.getExternalStoragePublicDirectory("").toString();
    }

    //下载路径，实质任然是内部存储  /cache
    public static String getDownloadCacheDirectory() {
        return Environment.getDownloadCacheDirectory().toString();
    }

    //系统路径，实质任然是内部存储  /system
    public static String getRootDirectory() {
        return Environment.getRootDirectory().toString();
    }
}
